package com.xugou.service;

import com.xugou.dao.BookMapper;
import com.xugou.pojo.Books;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author xugou
 * @date 2021/11/11  17:18
 */

public class BookServiceImpl implements BookService{

    //service层调用dao层:组合Dao
    private BookMapper bookMapper;

    //set方法利用Spring进行注入，若有注解可以自动注入
    public void setBookMapper(BookMapper bookMapper) {
        this.bookMapper = bookMapper;
    }

    public int addBook(Books book) {
        return bookMapper.addBook(book);
    }

    public int deleteBookById(int id) {
        return bookMapper.deleteBookById(id);
    }

    public int updateBook(Books book) {
        return bookMapper.updateBook(book);
    }

    public Books queryBookById(int id) {
        return bookMapper.queryBookById(id);
    }

    public List<Books> queryAllBook() {
        return bookMapper.queryAllBook();
    }

    public Books queryBookByName(String bookName) {
        return bookMapper.queryBookByName(bookName);
    }
}


